#ifndef VEC2D
#define VEC2D

#include <base\vec2i.h>

#include <cmath>

struct vec2d {

  double x;
  double y;

  vec2d() : x(0), y(0) {
  }

  vec2d(double _x, double _y) : x(_x), y(_y) {
  }

  double &operator[](int index) {
    if (index == 0) return x;
    else return y;
  }

  vec2d operator-(vec2d B) {
    vec2d diff(B.x - x, B.y - y);
    return diff;
  }

  vec2d operator*(double val) {
    vec2d mult(x * val, y * val);
    return mult;
  }

  vec2d operator/(double val) {
    vec2d mult(x / val, y / val);
    return mult;
  }

  vec2i operator%(int val) {
    vec2i mult((int) floor(x) % val, (int) floor(y) % val);
    return mult;
  }

  bool operator==(vec2d b) {
    return (x == b.x && y == b.y);
  }

  bool operator!=(vec2d b) {
    return !(x == b.x && y == b.y);
  }

  vec2d operator*(vec2d b) {
    vec2d mult(x * b.x, y * b.y);
    return mult;
  }

  vec2d getFloor() {
    return vec2d(floor(x), floor(y));
  }
};

#endif